package app.page;

import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import org.openqa.selenium.By;

public class WorkspacePage extends BasePage{


    public WorkspacePage(AppiumDriver<MobileElement> driver) {
        super(driver);
    }

    By report=By.cssSelector("*[text='汇报']");
    By useImmed=By.cssSelector("*[text='立即使用']");
    By dailyReport=By.cssSelector("*[text='日报']");
    By workToday=By.xpath("(//android.widget.EditText)[1]");
    String id="请选择汇报对象";

    By companyContact=By.cssSelector("*[text='企业通讯录']");
    By search=By.xpath("(//android.widget.TextView)[3]");
    By searchContent=By.xpath("//android.widget.EditText");
    By tickContacts=By.xpath("(//android.widget.ImageView)[3]");
    By ok=By.cssSelector("*[text*='确定']");
//    By submit=By.cssSelector("*[text='提交']");
    String submit="提交";
    By back=By.xpath("(//android.widget.TextView)[1]");

    public WorkspacePage addReport(String jobDesc,String contact) throws InterruptedException {
        click(report);
//        click(useImmed);
        click(dailyReport);
        sendKeys(workToday,jobDesc);
        click(id);
        click(companyContact);
        click(search);
        sendKeys(searchContent,contact);
        Thread.sleep(3000);
        click(tickContacts);
        click(ok);
        slideDown();
        click(submit);
        click(back);
        click(back);
        return new WorkspacePage(driver);
    }
}
